package com.hh.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

import com.hh.jdbc.JDBCDemo;

public class ShowDAO {
	
	public boolean insertShow(String hospital,String connecter,String conmobile,String shower,String shomobile,String vcode){
		Connection con = null;
        PreparedStatement statement = null;
        try {
            Class.forName(JDBCDemo.cfn);
            con = DriverManager.getConnection(JDBCDemo.url,JDBCDemo.user,JDBCDemo.password);
            String sql = "insert into hh_showapply (hospital,connecter,conmobile,shower,shomobile,vcode,created_at) "
            		+ " values(?,?,?,?,?,?,GETDATE())" ;
            statement = con.prepareStatement(sql);
            statement.setString(1, hospital);
            statement.setString(2, connecter);
            statement.setString(3, conmobile);
            statement.setString(4, shower);
            statement.setString(5, shomobile);
            statement.setString(6, vcode);
            int i  = statement.executeUpdate();
            if(i>0){
            	return true;
            }
           
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }finally{
            try {
                if(statement != null) statement.close();
                if(con != null) con.close();
            } catch (Exception e2) {
                // TODO: handle exception
                e2.printStackTrace();
            }
        }
        return false;
	}
}
